package cn.getech.data.development.mapper;

import cn.getech.data.development.entity.JobDepHistory;
import cn.getech.data.development.entity.JobStaticDay;
import cn.getech.data.development.entity.ProcInfo;
import cn.getech.data.development.model.dto.JobRunTOPDto;
import cn.getech.data.development.model.qo.CMClusterSearchTimeQO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;


/**
 * <p>
 * 任务执行历史表 Mapper 接口
 * </p>
 *
 * @author zenith
 * @since 2018-08-27
 */
@Mapper
public interface JobDepRunHistoryMapper extends BaseMapper<JobDepHistory> {
    List<Integer> selectIdList(Map<String,Object> map);

    List<JobDepHistory> getInfoByJobId(@Param("jobIds") List jobIds);

    List<JobDepHistory> selectByLimit20(@Param("depId")Long depId,@Param("limitSize")Integer limitSize);

    JobDepHistory selecetByIdOne(@Param("depId")Long depId);

    List<String> selectOozieIdByDepId(@Param("depId")Long depId);

    void batchUpdateStatus(@Param("jobDepHistories")List<JobDepHistory> jobDepHistories);

    void batchUpdateStopStatus(@Param("jobDepHistories")List<JobDepHistory> jobDepHistories);

    IPage<JobDepHistory> queryPage(Page<JobDepHistory> page, @Param("params") Map<String, Object> params);

    void removeLogicById(@Param("id")  Integer id);

    List<JobRunTOPDto> runTimeTop(@Param("cmClusterSearchTimeQO")CMClusterSearchTimeQO cmClusterSearchTimeQO);

    List<JobStaticDay> selectCountFailNum(@Param("searchTime") String searchTime);

    List<ProcInfo> listDepJobs(@Param("jobDepInfoIds")List<Integer> jobDepInfoIds, @Param("type")Integer type);

    List<Long> logUsers(@Param("jobDepInfoIds")List<Integer> jobDepInfoIds, @Param("type")Integer type);

    List<String> selectByDepId(@Param("depId") Long depId);
}
